import styles from "./index.module.scss";
import { Pagination } from "antd";
import { useDispatch, useSelector } from "react-redux";
import closeBtn from "@/assets/public/close-btn.png";
import closeBtnLight from "@/assets/public/close-btn-light.png";
import searchBtn from "@/assets/public/icon-search.png";
import searchBtnLight from "@/assets/public/icon-search-light.png";
import { setLayers, setLayersLevel2 } from "@/store";
import Selectcu from "@/component/select";

export default function Model(props) {
  const dispatch = useDispatch();
  const { name } = props;
  const theme = useSelector((state) => state.theme);
  const handleClose = () => {
    dispatch(
      setLayers({
        query: {},
        name: "",
        other: {},
      })
    );
  };

  const getValue = (value) => {
    console.log(value);
  };

  const getValue2 = (value) => {
    console.log(value);
  };

  return (
    <div className={styles.model}>
      <header className={styles.header}>
        {theme ? (
          <img
            style={{
              width: "20px",
              height: "22px",
            }}
            onClick={handleClose}
            src={closeBtnLight}
            alt="加载中..."
          />
        ) : (
          <img
            style={{
              width: "20px",
              height: "22px",
            }}
            onClick={handleClose}
            src={closeBtn}
            alt="加载中..."
          />
        )}
        <span className={styles.title}>{name}</span>
      </header>
      <div className={styles.searchBox}>
        <div className={styles.inputContainer}>
          <Selectcu
            width={220}
            options={[
              {
                value: "1",
                label: "技能专业",
              },
            ]}
            placeholder="技能专业"
            getSelectValue={getValue.bind(this)}
          ></Selectcu>
          <Selectcu
            width={220}
            placeholder="厂家能力"
            options={[
              {
                value: "1",
                label: "华为",
              },
            ]}
            getSelectValue={getValue2.bind(this)}
          ></Selectcu>
          <div className={styles.searchBtn}>
            <span>搜索</span>
            {theme ? (
              <img
                className={styles.searchBtnImg}
                src={searchBtnLight}
                alt="加载中..."
              />
            ) : (
              <img
                className={styles.searchBtnImg}
                src={searchBtn}
                alt="加载中..."
              />
            )}
          </div>
        </div>
        <div className={styles.listHeader}>
          <div className={styles.listItem}>姓名</div>
          <div className={styles.listItem}>性别</div>
          <div className={styles.listItem}>教育水平</div>
          <div className={styles.listItem}>厂家能力</div>
          <div className={styles.listItem}>技能专业</div>
          <div className={styles.listItem}>人员状态</div>
          <div className={styles.listItem}>工龄</div>
          <div className={styles.listItem}>意向地</div>
        </div>
        {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((item) => {
          return (
            <div className={styles.list} key={item}>
              <div className={styles.listItem}>
                <span className="text-overflow">姓名</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">一级项目</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">二级项目</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">区域</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">人员类型</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">专业岗位</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">离职原因</span>
              </div>
              <div className={styles.listItem}>
                <span className="text-overflow">人员状态</span>
              </div>
            </div>
          );
        })}
      </div>
      <div className={styles.pagination}>
        <Pagination
          total={805}
          showTotal={(total) => `共 ${total} 条`}
          defaultPageSize={20}
          defaultCurrent={1}
        />
      </div>
    </div>
  );
}
